package com.andnnl.guava;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * Created by chenss on 2021/4/29.
 */
public class ScheduledTest {
    static Logger logger = LoggerFactory.getLogger("");

    public static void main(String[] args) {

        ScheduledExecutorService scheduledExecutorService = new ScheduledThreadPoolExecutor(10);
        logger.info("start");
        scheduledExecutorService.schedule(() -> {
            logger.info("scheduledExecutorService====>>>延时器");
        }, 10, TimeUnit.SECONDS);//线程实现，2、延迟时间 3.单位
        scheduledExecutorService.shutdown();

    }
}
